﻿@using KMF.Common
@using KMF.WebUI.Areas.KMFadmin.Models
@using KMF.WebUI.Areas.KMFadmin.CustomHelpers
@model ProductCategoryDto
@{
    ViewBag.Title = "AddCategory";
    Layout = "~/Areas/KMFadmin/Views/Shared/_Layout.cshtml";   
}
<link href="~/Content/Site.css" rel="stylesheet" />

@section LeftMenu
{
    <div id="left">
        <div class="LeftMenuWraper">
            <div class="leftMenuHeader">
                <span style="padding-left: 10px;">
                    <strong>Truy cập nhanh</strong>
                </span>
            </div>
            <ul id="p-quick-menu" class="quick-menu">
                <li class="qmn-info-pro">Thông danh mục</li>
                <li class="qmn-seo-pro">Khuyến mại</li>
                <li class="qmn-seo-pro">Quà tặng</li>
            </ul>
            <div class="leftMenuFooter"></div>
        </div>
    </div>
    <!-- END #left -->
}

<nav>
    <div id="jCrumbs" class="breadCrumb module">
        <ul>
            <li><a href="@Url.Action("Index", "AdminHome")"><i class="bootstrap icon-home"></i></a></li>
            <li><a href="javascript:void(0)">Sản phẩm</a> </li>
            <li><a href="@Url.Action("Index", "AdminProductCategory")">Danh mục sản phẩm</a> </li>
            <li><a href="@Url.Action("AddCategory", "AdminProductCategory")">Thêm danh mục</a> </li>
        </ul>
    </div>
</nav>
<div class="toolBox">
    @Html.ToolBox(new List<object> { new Save { ClassCss = "Save", ActionName = "Javascript:void(0)" }, new Delete { ClassCss = "Del", ActionName = "DelCategory" }, new Back { ClassCss = "Back", ActionName = @Url.Action("Index", "AdminProductCategory") } })
</div>

@using (Html.BeginForm("AddCategory", "AdminProductCategory", FormMethod.Post, new { @class = "formAddCate", enctype = "multipart/form-data" }))
{
    <div class="box-Info">
        <div class="Info-header">
            <span>Thêm mới danh mục </span>
        </div>
        <div class="Info-body">
            <fieldset class="specBox">
                <legend>Cấu hình:</legend>
                <div class="specItem">
                    <span>Kích hoạt: </span>
                    @Html.CheckBoxFor(m => m.Active)
                </div>
                <div class="specItem">
                    <span>Hiển thị trên trang chủ: </span>
                    @Html.CheckBoxFor(m => m.ShowHome)
                </div>
                <div class="specItem">
                    <span>Nổi bật: </span>
                    @Html.CheckBoxFor(m => m.IsHot)
                </div>
            </fieldset>
            <table cellpadding="0" cellspacing="0" width="100%" border="0" class="table-info">
                <tr>
                    <td class="tInfoLeft">Code
                    </td>
                    <td class="tInfoRight"></td>
                </tr>
                <tr>
                    <td class="tInfoLeft">Tên danh mục
                    </td>
                    <td class="tInfoRight">
                        @Html.TextBoxFor(m => m.Name)
                        @Html.ValidationMessageFor(m => m.Name)
                    </td>
                </tr>
                <tr>
                    <td class="tInfoLeft">Danh mục cha
                    </td>
                    <td class="tInfoRight">
                        @Html.DropDownListFor(m => m.ParentId, new SelectList(((List<ProductCategoryDto>)(ViewBag.ParentList)) ?? new List<ProductCategoryDto>(), "Id", "Name"))
                    </td>
                </tr>
                <tr>
                    <td class="tInfoLeft">Mô tả ngắn
                    </td>
                    <td class="tInfoRight">
                        @Html.TextAreaFor(m => m.Summary, new { @class = "texareaCss" })
                    </td>
                </tr>
                <tr>
                    <td class="tInfoLeft">Mô tả danh muc
                    </td>
                    <td class="tInfoRight">
                        <textarea class="ckeditor" rows="5" cols="60" id="editor1" name="SummaryCate">@Model.SummaryCate</textarea>
                    </td>
                </tr>
                <tr>
                    <td class="tInfoLeft">Nội dung
                    </td>
                    <td class="tInfoRight">
                        <textarea class="ckeditor" rows="10" cols="60" id="editor2" name="Description">@Model.Description</textarea>
                    </td>
                </tr>
                <tr>
                    <td class="tInfoLeft">Khoảng giá
                    </td>
                    <td class="tInfoRight">
                        @Html.TextBoxFor(m => m.PriceRanges)
                    </td>
                </tr>
                <tr>
                    <td class="tInfoLeft">Icon
                    </td>
                    <td class="tInfoRight">
                        @Html.TextBoxFor(m => m.Icon, new { @style = "width:150px" })
                    </td>
                </tr>
                <tr>
                    <td class="tInfoLeft">Ảnh đại diện
                    </td>
                    <td class="tInfoRight">
                        <input type="file" name="fileImagePath" />
                    </td>
                </tr>
                <tr>
                    <td class="tInfoLeft">Meta title
                    </td>
                    <td class="tInfoRight">
                        @Html.TextBoxFor(m => m.MetaTitle, new { @onkeyup = "countTextAreaChar(this, 70,'countNewsMetaTitle')" })<br />
                        <input readonly="readonly" class="cssInputHidden" type="text" name="countNewsMetaTitle" size="3" maxlength="3" style="width: 53px; height: 23px; margin: 0px; padding: 0px 0px 0px 10px;" value="0">
                        ký tự. Hầu hết các công cụ tìm kiếm sử dụng tối đa <span style="color: red;">70</span> ký tự cho tiêu đề
                    </td>
                </tr>
                <tr>
                    <td class="tInfoLeft">Meta description
                    </td>
                    <td class="tInfoRight">
                        @Html.TextAreaFor(m => m.MetaDescription, new { @class = "texareaCss", @onkeyup = "countTextAreaChar(this, 160,'countNewsMetaDesc')" })
                        <br />
                        <input readonly="readonly" class="cssInputHidden" type="text" name="countNewsMetaDesc" size="3" maxlength="3" style="width: 53px; height: 23px; margin: 0px; padding: 0px 0px 0px 10px;" value="0">
                        ký tự. Hầu hết các công cụ tìm kiếm sử dụng tối đa <span style="color: red;">160</span> ký tự cho các mô tả
                    </td>
                </tr>
                <tr>
                    <td class="tInfoLeft">Meta keyword
                    </td>
                    <td class="tInfoRight">
                        @Html.TextAreaFor(m => m.MetaKeyword, new { @class = "texareaCss" })
                    </td>
                </tr>
                <tr>
                    <td class="tInfoLeft">Thứ tự
                    </td>
                    <td class="tInfoRight">
                        @Html.TextBoxFor(m => m.Ordering, new { @class = "txtOrdering", @Value = "0" })
                    </td>
                </tr>
                <tr>
                    <td class="tInfoLeft">Thứ tự Trên Trang chủ
                    </td>
                    <td class="tInfoRight">
                        @Html.TextBoxFor(m => m.OrderOnHome, new { @class = "txtOrdering", @Value = "0" })
                    </td>
                </tr>
                @*<tr>
                    <td class="tInfoLeft">Kích hoạt
                    </td>
                    <td class="tInfoRight">
                        @Html.CheckBoxFor(m => m.Active, new { @checked = "checked" })
                    </td>
                </tr>
                <tr>
                    <td class="tInfoLeft">Hiển thị trên trang chủ
                    </td>
                    <td class="tInfoRight">
                        @Html.CheckBoxFor(m => m.ShowHome, new { @checked = "checked" })
                    </td>
                </tr>*@
            </table>

        </div>
    </div>

    <div class="box-Info" style="display: none;">
        <div class="Info-header">
            <span>Khuyến mại</span>
        </div>
        <div class="Info-body ib-infoseo">
            <table class="table-odd table-plist">
                <colgroup>
                    <col style="width: 30px" />
                    <col style="width: 300px" />
                    <col />
                    <col />
                    <col />
                    <col />
                    <col />
                    <col />
                </colgroup>
                <tr>
                    <th scope="col"></th>
                    <th scope="col">Tên chiến dịch</th>
                    <th scope="col">Sử dụng %</th>
                    <th scope="col">% chiết khấu</th>
                    <th scope="col">Số tiền chiết khấu</th>
                    <th scope="col">Ngày bắt đầu</th>
                    <th scope="col">Ngày kết thúc</th>
                    <th scope="col"></th>
                </tr>
                @foreach (var item in (List<DiscountDto>)ViewBag.DiscountList)
                {
                    <tr class="@string.Format("bn-{0}", item.DiscountId)">
                        <td>
                            <input type="radio" name="DiscountId" value="@item.DiscountId"/>
                        </td>
                        <td>
                            @item.Name
                        </td>
                        <td>
                            <input type="checkbox" name="UsePercent" @string.Format("{0}", item.UsePercentage ? "checked" : "")/>
                        </td>
                        <td>
                            @item.DiscountPercentage.ToString("#,###")
                        </td>
                        <td>
                            @item.DiscountAmount.ToString("#,###")
                        </td>
                        <td>
                            @item.StartDate.ToString("dd/MM/yyyy")
                        </td>
                        <td>
                            @item.EndDate.ToString("dd/MM/yyyy")
                        </td>
                        <td>
                            <a href="@Url.Action("EditDiscount", "AdminDiscount", new { id = item.DiscountId })" title="chỉnh sửa" class="icon-edit-v2 fl-l bootstrapTangoSmall"></a>
                        </td>
                    </tr>
                }
            </table>
        </div>
    </div>

    <div class="box-Info" style="display: none;">
        <div class="Info-header">
            <span>Quà tặng</span>
        </div>
        <div class="Info-body ib-infoseo">
            <table class="table-odd table-plist">
                <colgroup>
                    <col style="width: 30px" />
                    <col style="width: 300px" />

                    <col />
                    <col />
                    <col />
                    <col />
                </colgroup>
                <tr>
                    <th scope="col">STT</th>
                    <th scope="col">Tên chiến dịch Gift</th>

                    <th scope="col">Mô tả</th>
                    <th scope="col">Ngày bắt đầu</th>
                    <th scope="col">Ngày kết thúc</th>
                    <th scope="col"></th>
                </tr>
                @foreach (var item in (List<GiftDto>)ViewBag.GiftList)
                {
                    <tr class="@string.Format("bn-{0}", item.GiftId)">
                        <td>
                            <input type="radio" name="GiftId" value="@item.GiftId"/>
                        </td>
                        <td>
                            @item.Name
                        </td>
                        <td>
                            @item.Description
                        </td>
                        <td>
                            @item.StartDate.ToString("dd/MM/yy")
                        </td>
                        <td>
                            @item.EndDate.ToString("dd/MM/yy")
                        </td>
                        <td>
                            <a href="@Url.Action("EditGift", "AdminGift", new { id = item.GiftId })" title="chỉnh sửa" class="icon-edit-v2 fl-l bootstrapTangoSmall"></a>
                        </td>
                    </tr>
                }
            </table>
        </div>
    </div>
}
@section scripts
{
    @Scripts.Render("~/bundles/KMFAdmin/jqueryval")
    <script src="@Url.Content("~/Areas/KMFadmin/Scripts/WYSIWYG/ckeditor/ckeditor.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Areas/KMFadmin/Scripts/WYSIWYG/ckfinder/ckfinder.js")" type="text/javascript"></script>
    <script type="text/javascript">
        var editor = CKEDITOR.replace('editor2');
        CKFinder.setupCKEditor(editor, '/Areas/KMFadmin/Scripts/WYSIWYG/ckfinder/');
    </script>
    <script>
        SubmitFormUseToolBox($('ul li.Save a'), $('form'));
    </script>
}

